package com.detoandy.service;

import com.detoandy.model.Blog;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;

import java.util.List;

/**
 * Created by zhengdt on 2017/8/21.
 */
@Service
public class BloggerService {

    @Autowired
    RestTemplate restTemplate;

    @HystrixCommand(fallbackMethod = "getAllBlogFallback")
    public List getAllBlog() {
        return restTemplate.getForObject("http://blog-service/blog/getAllBlog",List.class);
    }

    public List getAllBlogFallback() {
        return null;
    }
}
